const manager = uni.getFileSystemManager();
const promisify = (api) => {
    return (options, ...params) => {
        return new Promise((resolve, reject) => {
            api(
                Object.assign({}, options, {
                    success: resolve,
                    fail: reject
                }),
                ...params
            );
        });
    };
};
const wxLogin = promisify(uni.login);
const wxGetUserProfile = promisify(uni.getUserProfile);
const wxGetLocation = promisify(uni.getLocation);
const wxDownloadFile = promisify(uni.downloadFile);
const wxOpenDocument = promisify(uni.openDocument);
const wxShareFileMessage = promisify(uni.shareFileMessage);
const wxChooseMedia = promisify(uni.chooseMedia);
const wxScanCode = promisify(uni.scanCode);
const wxGetSystemInfo = promisify(uni.getSystemInfo);
const fileManagerAccess = promisify(manager.access);
const fileManagerMkdir = promisify(manager.mkdir);
const fileManagerReadFile = promisify(manager.readFile);
module.exports = {
    wxLogin: wxLogin,
    wxGetUserProfile: wxGetUserProfile,
    wxGetLocation: wxGetLocation,
    wxDownloadFile: wxDownloadFile,
    wxOpenDocument: wxOpenDocument,
    wxShareFileMessage: wxShareFileMessage,
    wxChooseMedia: wxChooseMedia,
    wxScanCode: wxScanCode,
    wxGetSystemInfo: wxGetSystemInfo,
    fileManagerAccess: fileManagerAccess,
    fileManagerMkdir: fileManagerMkdir,
    fileManagerReadFile: fileManagerReadFile
};
